﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BrnMall.Core;
using BrnMall.Manager.Domain.Distribution;

namespace QIDong.WeApp.Models
{
    /// <summary>
    /// 分销商
    /// </summary>
    public class DistributorOutDto
    {
        /// <summary>
        /// 
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 用户ID
        /// </summary>
        public int UserId { get; set; }
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int StoreId { get; set; }
        /// <summary>
        /// 显示Logo
        /// </summary>
        public string ShowLogo { get; set; }
        /// <summary>
        /// 上级总代理商ID
        /// </summary>
        public int AgentDId { get; set; }
        /// <summary>
        /// 等级
        /// </summary>
        public int GradeId { get; set; }
        /// <summary>
        /// 等级
        /// </summary>
        public DisGrade DisGrade { get; set; }
        /// <summary>
        /// 上级分销商ID
        /// </summary>
        public int ParentId { get; set; }
        /// <summary>
        /// 分销等级
        /// </summary>
        public int DisLevel { get; set; }

        /// <summary>
        /// 路径
        /// </summary>
        public string Path { get; set; }
        /// <summary>
        /// 订单总额
        /// </summary>
        public decimal OrdersTotal { get; set; }
        /// <summary>
        /// 订单数量
        /// </summary>
        public int OrdersCount { get; set; }
        /// <summary>
        /// 佣金额度
        /// </summary>
        public decimal AccountBalance { get; set; }
        /// <summary>
        /// 历史提现额度
        /// </summary>
        public decimal RequestBalance { get; set; }
        /// <summary>
        /// 是否总代理，总代理提成所有分销商额度
        /// </summary>
        public int IsAgent { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 状态0:待审核，1：已审核，2：已关闭
        /// </summary>
        public int Status { get; set; }
        /// <summary>
        /// 分销店铺名称
        /// </summary>
        public string DisStoreName { get; set; }
        /// <summary>
        /// 联系人
        /// </summary>
        public string LinkMan { get; set; }
        /// <summary>
        /// 联系电话
        /// </summary>
        public string PhoneNumber { get; set; }
        

        /// <summary>
        /// 
        /// </summary>
        public DistributorOutDto()
        {
            Id = 0;
            UserId = 0;
            StoreId = 0;
            AgentDId = 0;
            GradeId = 0;
            ParentId = 0;
            Path =ShowLogo= string.Empty;
            OrdersTotal = OrdersCount = 0;
            AccountBalance = RequestBalance = IsAgent = Status =DisLevel= 0;
            CreateTime = new DateTime(1900, 1, 1);
            DisStoreName = LinkMan = PhoneNumber = string.Empty;
        }
    }

    /// <summary>
    /// 佣金明细
    /// </summary>
    public class BrokerageOutDto
    {
        public int Id { get; set; }

        /// <summary>
        /// 佣金结算给谁
        /// </summary>
        public int UserId { get; set; }
        /// <summary>
        /// 佣金结算给谁
        /// </summary>
        public Distributor Distributor { get; set; }
        
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int StoreId { get; set; }

        /// <summary>
        /// 来源订单号
        /// </summary>
        public string OrderNo { get; set; }

        /// <summary>
        /// 结佣时间
        /// </summary>
        public DateTime TradeTime { get; set; }
        /// <summary>
        /// 下单人
        /// </summary>
        public PartUserInfo TradeUser { get; set; }

        /// <summary>
        /// 结佣金额
        /// </summary>
        public decimal OrderAmount { get; set; }

        /// <summary>
        /// 佣金
        /// </summary>
        public decimal BrokerageAmount { get; set; }

        /// <summary>
        /// 费用类型0：成交返佣
        /// </summary>
        public int BrokerageType { get; set; }

        /// <summary>
        /// 状态0待审核，1已审核，20待发放，21已发放
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        /// 备注
        /// </summary>

        public string Remark { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        public int ApprovedUserId { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        public string ApprovedUserName { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime ApprovedTime { get; set; }
        /// <summary>
        /// 分佣提成点%
        /// </summary>
        public int BrokerageRise { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public BrokerageOutDto()
        {
            Id = 0;
            UserId = StoreId = 0;
            OrderNo = string.Empty;
            TradeTime=new DateTime(1900,1,1);
            OrderAmount = 0;
            BrokerageAmount = 0;
            BrokerageType = 0;
            Status = 0;
            Remark = string.Empty;
            ApprovedTime=new DateTime(1900,1,1);
            ApprovedUserId = 0;
            ApprovedUserName = string.Empty;
        }
    }
    /// <summary>
    /// 佣金提现记录
    /// </summary>
    public class BrokerageRequestOutDto
    {
        public int Id { get; set; }
        /// <summary>
        /// 提现人
        /// </summary>
        public int UserId { get; set; }
        /// <summary>
        /// 提现人
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        /// 请求订单号
        /// </summary>
        public string Brsn { get; set; }
        /// <summary>
        /// 提现类型0：微信企业转账
        /// </summary>
        public int RequestType { get; set; }
        /// <summary>
        /// 提现用户的平台OpenID
        /// </summary>
        public string RequestOpenId { get; set; }
        /// <summary>
        /// 申请时间
        /// </summary>
        public DateTime RequestTime { get; set; }
        /// <summary>
        /// 提现金额
        /// </summary>
        public decimal Amount { get; set; }
        /// <summary>
        /// 提现人真实姓名
        /// </summary>
        public string RequestUserRealName { get; set; }
        /// <summary>
        /// 提现银行账号
        /// </summary>
        public string RequestBankAccount { get; set; }
        /// <summary>
        /// 提现银行名称
        /// </summary>
        public string RequestBankName { get; set; }
        /// <summary>
        /// 联系电话
        /// </summary>
        public string PhoneNumber { get; set; }
        /// <summary>
        /// 状态0:待审核1：已审核，2：已拒绝
        /// </summary>
        public int Status { get; set; }
        /// <summary>
        /// 0：待发放，1：已发放
        /// </summary>
        public int PayStatus { get; set; }
        /// <summary>
        /// 审核人
        /// </summary>
        public int ApprovedUserId { get; set; }
        /// <summary>
        /// 审核人
        /// </summary>
        public string ApprovedUserName { get; set; }
        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime ApprovedTime { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 打款时间
        /// </summary>
        public DateTime SendTime { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public BrokerageRequestOutDto()
        {
            Id = UserId = RequestType = 0;
            UserName = RequestOpenId =Brsn= string.Empty;
            RequestTime = new DateTime(1900, 1, 1);
            RequestUserRealName = RequestBankAccount = RequestBankName = PhoneNumber = string.Empty;
            Status = ApprovedUserId = 0;
            ApprovedUserName = string.Empty;
            ApprovedTime =SendTime= new DateTime(1900, 1, 1);
            Remark = string.Empty;
            Amount =PayStatus= 0;
        }
    }
}